<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<f:view>
	<f:loadBundle var="text" basename="#{suggestionList.bundleName}" />
	<h:head>
		<title>#{text['suggestionList.title']}</title>
		<meta name="menu" content="AdminMenu" />
	</h:head>
	<h:body>
		<div class="span10">
			<h2>#{text['suggestionList.heading']}</h2>

			<h:form id="searchForm" styleClass="form-search">
				<div id="search" class="input-append">
					<h:inputText id="q" size="20" value="#{suggestionList.query}"
						styleClass="input-medium search-query" />
					<h:commandButton styleClass="btn" action="#{suggestionList.search}"
						value="#{text['button.search']}" />
				</div>
			</h:form>

			<h:form id="editSuggestion">

				<div id="actions" class="form-actions">
					<h:commandButton action="#{suggestionForm.add}"
						value="#{text['button.add']}" id="add"
						styleClass="btn btn-primary">
						<f:param name="from" value="list" />
					</h:commandButton>
					<h:commandButton value="#{text['button.done']}" action="mainMenu"
						id="cancel" immediate="true" styleClass="btn">
					</h:commandButton>
				</div>

				<p:dataTable id="suggestionList" var="suggestion"
					value="#{suggestionList.suggestions}"
					sortBy="#{suggestionList.sortColumn}"
					paginator="true"
					rows="25"
					paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="5,10,15">
					<p:column style="width: 25%">
						<f:facet name="header">
							<p:column sortBy="title">
								<h:outputText value="#{text['suggestion.title']}" />
							</p:column>
						</f:facet>
						<h:commandLink action="#{suggestionForm.edit}"
							value="#{suggestion.title}">
							<f:param name="id" value="#{suggestion.id}" />
							<f:param name="from" value="list" />
						</h:commandLink>
					</p:column>
					<p:column style="width: 34%">
						<f:facet name="header">
							<p:column sortBy="description">
								<h:outputText value="#{text['suggestion.description']}" />
							</p:column>
						</f:facet>
						<h:outputText value="#{suggestion.description}" />
					</p:column>
					<p:column style="width: 34%">
						<f:facet name="header">
							<p:column sortBy="description">
								<h:outputText value="#{text['suggestion.user']}" />
							</p:column>
						</f:facet>
						<h:outputText value="#{suggestion.user.firstName}" />
					</p:column>
				</p:dataTable>
			</h:form>
		</div>
	</h:body>
</f:view>
</html>